﻿using System.Windows;
using System.Windows.Controls;
using WcsZz.Extend;
using wms_wpf.Apiservice;
using wms_wpf.InPut;

namespace wms_wpf.DialogView
{
    /// <summary>
    /// Dialog5.xaml 的交互逻辑
    /// </summary>
    public partial class Dialog5 : UserControl
    {
        public Dialog5(string Name)
        {
            this.Name = Name;
            service=new UserService();
            InitializeComponent();
        }

        public string Name;
        private readonly MyUserService service;
 

        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;
            ComboBoxItem selectedItem = comboBox.SelectedItem as ComboBoxItem;
            if (selectedItem != null)
            {
                // 获取ComboBox选中项的值
                string selectedValue = selectedItem.Content.ToString();
                // TODO: 处理ComboBox选中项的值
            }

        }

        private async void Confirm_Click(object sender, RoutedEventArgs e)
        {
            InPut_UserService5 InPut = new InPut_UserService5();
            InPut.UserName = Name;
            InPut.Name = Combobox.Text;
            bool result= await service.UpdateRole(InPut);
            if (result) EventAggregatorHelper.EventAggregator.SendMessage("修改成功！", "GetList_View_User");
        }
    }
}
